package com.anosine.gpsl.android.util;

import com.anosine.gpsl.android.GPSLApp;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Build;
import android.telephony.TelephonyManager;
/**  
 * @Title:  WelcomeActivity  
 * @Package com.anosine.gpsl.android.ui.activity
 * @Description: 欢迎界面 
 * @author: sunny     
 * @date:   2015-11-17
 * @version V1.0     
 */  
public class DeviceUtil {
	 public static String getDeviceImei() {
	        TelephonyManager tm = (TelephonyManager) GPSLApp.getInstance().getSystemService(Context.TELEPHONY_SERVICE);
	        if (tm != null) {
	            String strImei = tm.getDeviceId();
	            return strImei;
	        }
	        return "000000000000000";
	    }

	    public static String getDeviceImsi() {
	        TelephonyManager tm = (TelephonyManager) GPSLApp.getInstance().getSystemService(Context.TELEPHONY_SERVICE);
	        if (tm != null) {
	            String strImsi = tm.getSubscriberId();
	            return strImsi;
	        }
	        return "000000000000000";
	    }

	    public static String getMobile() {
	        return Build.MODEL;
	    }
	    public static String getVersionName(Context context) throws Exception  
		{  
		        // 获取packagemanager的实例  
		        PackageManager packageManager = context.getPackageManager();  
		        // getPackageName()是你当前类的包名，0代表是获取版本信息  
		        PackageInfo packInfo = packageManager.getPackageInfo(context.getPackageName(),0);  
		        String version = packInfo.versionName;  //versionCode
		        return version;  
		}  
}
